import { useAxios } from '@hooks/useAxios'
import { useMutation } from '@tanstack/react-query'
import { API_UPLOAD_URL } from './baseApi'

export default function useUploadMutation() {
  const { http } = useAxios()
  return useMutation(async (data) => {
    const formData = new FormData()
    formData.append('file', data.file)

    return await http.post(API_UPLOAD_URL, formData)
  })
}
